package com.etime.service.impl;

import com.etime.dao.impl.StudentDaoImpl;
import com.etime.entity.Student;
import com.etime.service.StudentService;

import java.util.List;

public class StudentServiceImpl implements StudentService {
  StudentDaoImpl studentDao = new StudentDaoImpl();

  @Override
  public boolean login(String username, String password) {
    boolean value = false;
    try {
      value = studentDao.login(username, password)==null?false:true;
    }
    catch (Exception e){
      System.out.println(e);
    }
    return value;
  }

  @Override
  public boolean delete(int id) {
    boolean value = false;
    value = studentDao.delete(id)>=0?true:false;
    return value;
  }

  @Override
  public boolean update(String password,int id) {
    boolean value = false;
    value = studentDao.update(password, id)>=0?true:false;
    return false;
  }

  @Override
  public boolean insert(Student student) {
    boolean value = false;
    value = studentDao.insert(student)>=0?true:false;
    return value;
  }

  @Override
  public List<Student> select(Student student) {
    List<Student> value = studentDao.select(student);
    return value;
  }

  @Override
  public List<Student> limitSelect(int index, int rows) {
    List<Student> value = studentDao.limitSelect(index, rows);
    return value;
  }
}
